/**
 * 
 */
package com.mvc.controller.myMenu;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mvc.model.report.ColligateReport;
import com.mvc.service.MyMenu.ReportServiceI;

/**
 * @author qingjie
 *
 */
@RequestMapping("/report")
@Controller
public class ReportController {
	
	@Autowired
	private ReportServiceI rsi;
	
	@RequestMapping("/findColligateReport")
	@ResponseBody
	public List<ColligateReport> findColligateReport(HttpServletRequest request){
		String personId = request.getParameter("personId");
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("personId", personId);
		return rsi.findColligateReport(params);
	}

	@RequestMapping("/getColligateReport")
	@ResponseBody
	public ColligateReport getColligateReport(HttpServletRequest request){
		String id = request.getParameter("id");
		return rsi.getColligateReportById(id);
	}
	
	/**
	 * 跳转到体检报告页面
	 * @return
	 */
	@RequestMapping("/colligateReportForAndroid")
	public String physicalReport(HttpServletRequest request) throws Exception {
		String id = request.getParameter("id");
		ColligateReport cr = rsi.getColligateReportById(id);
		request.setAttribute("cr", cr);
		return "/web/MyMenu/physicalReportForAndroid";
	}
}
